import Vue from "vue";
import Vuex from "vuex";
import createPersistedState from "vuex-persistedstate"
Vue.use(Vuex)
const store=new Vuex.Store({
    state:{
        token:''
    },
    mutations:{
      setTokenn(state,data){
         state.token=data;
         localStorage.setItem('tokenn',JSON.stringify(data))
      },
      //清除vuex保存到的数据
      mapClearState(state){
        for(let item in state){
            state[item] = ''
        }
      },
    },
    plugins: [createPersistedState()]
})




export default store